Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update debian folder for hwlib client to follow the recent MIR policy #209

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

nadzyah
Copy link
Collaborator

@nadzyah nadzyah commented Oct 10, 2024

This PR resolves C3-777. The key changes include the following:

  • Added autopkgtests to ensure proper validation of the Rust library.

  • Included a README.source file as per packaging guidelines:

    RULE: - The package uses a debian/watch file whenever possible. In cases where
    RULE: this is not possible (e.g. native packages), the package should either
    RULE: provide a debian/README.source file or a debian/watch file (with
    RULE: comments only) providing clear instructions on how to generate the
    RULE: source tar file.

  • Updated debian/rules with the CARGO_VENDOR_DIR environment variable and added the XS-Vendored-Sources-Rust header to the debian/control file for proper vendoring of dependencies.

  • Changed the vendor folder name from vendor/ to rust-vendor/ to follow the ubuntu-mir Rust policy

I also updated the debian/changelog file to prepare the package updated version 0.0.1~ppa2 for publishing to the hwcert ppa.

autopkgtests

The autopkgtests are designed to run the existing Rust tests using the library after installation. While the Ubuntu MIR Rust policy does not provide explicit guidelines for writing autopkgtests for Rust packages with vendoring, it references ubuntu/authd as an example of how vendoring can be implemented in tests. I adopted a similar approach to write the autopkgtests, following the model outlined in this example.

Cargo vendoring changes

In accordance with the latest Ubuntu MIR Rust policy, the CARGO_VENDOR_DIR environment variable must be set in debian/rules (see here). This informs dh-cargo that vendored dependencies are in use. When this variable is set, dh-cargo uses /usr/share/cargo/bin/dh-cargo-vendored-sources to verify that the dependencies listed in the XS-Vendored-Sources-Rust header in the debian/control file match the actual dependencies located in CARGO_VENDOR_DIR. Consequently, the XS-Vendored-Sources-Rust header has been added to debian/control (as demonstrated in the authd example).

Testing

The changes were verified in the testppa, and the build passes for all the supported architectures. The autopkgtests were run for this PPA with no failure, the results are available here:

Copy link

github-actions bot commented Oct 10, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
648 625 96% 70% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: e9dad91 by action🐍

@nadzyah nadzyah requested a review from zyga October 10, 2024 11:09
zyga
zyga previously approved these changes Oct 10, 2024
Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments inline.

My suggestions for the whole structure is to split/recombine some patches so things like touching .lock files is done only once, and that related changes, like rust-vendor are done in one patch.

Overall it looks okay. Does autopkgtest pass? :)

.github/workflows/test_client.yaml Show resolved Hide resolved
client/README.md Outdated Show resolved Hide resolved
@@ -9,12 +9,8 @@ cat > /tmp/.cargo/config.toml << EOL
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "/tmp/vendor"
directory = "$(pwd)/rust-vendor"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be combined with the other patch that touches the same path?

@@ -5,4 +5,4 @@
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
directory = "rust-vendor"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this also belongs with the other patches that touch rust-vendor.

client/hwlib/debian/control Show resolved Hide resolved
client/hwlib/debian/tests/run-tests.sh Outdated Show resolved Hide resolved
client/hwlib/debian/tests/run-tests.sh Outdated Show resolved Hide resolved
client/hwlib/debian/vendor-rust.sh Outdated Show resolved Hide resolved
client/hwlib/debian/control Outdated Show resolved Hide resolved
client/hwlib/debian/tests/control Outdated Show resolved Hide resolved
@nadzyah
Copy link
Collaborator Author

nadzyah commented Oct 10, 2024

Overall it looks okay. Does autopkgtest pass? :)

@zyga Sure, the links were added to the PR description, you can check them to make sure the tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants